add Event Listener
public abstract void addEventListener(EventType eventType, Observer<Event> listener, boolean useCapture)
Adds the given listener to the event target.
You can use one of the predefined event types provided by the EventType class as an eventType parameter or create it manually through the of, for example:
EventType.of("click");
Content copied to clipboard
eventType is dispatched, the on method will be invoked if one of the following statements is true: - the event is at the AT_TARGET phase
- the method was invoked with the
useCapture=trueand the event is at the CAPTURING_PHASE phase - the method was invoked with the
useCapture=falseand the event is at the BUBBLING_PHASE phase
EventListener instance for the same event type twice with the different useCapture values, the EventListener#on(Object) method will be invoked twice in the AT_TARGET phase as the engine distinguishes these event listeners. This method does nothing if it has been already invoked with the same parameters.
Parameters
event Type
the type of the event that the listener will listen to
listener
the event listener instance
use Capture
a flag indicating that events of the given eventType will be dispatched to the given listener before being dispatched to any other EventTarget beneath it in the DOM tree. Events that are bubbling upward through the tree will not trigger the listener
Throws
when the document this instance belongs to is closed